package com.aorise.utils;

/**
 * @Auther: zhouhao
 * @Date: 2019/7/15
 * @Description:    卡口设备类型
 */
public enum  BayonetCameraEnum {

    BayonetCamera1(1,"标清网络摄像机"),
    BayonetCamera2(2,"高清网络照相机"),
    BayonetCamera3(3,"高清网络摄像机720P"),
    BayonetCamera4(4,"高清网络摄像机1080P"),
    BayonetCamera5(5,"超清网络摄像机"),
    BayonetCamera6(6,"智能交通高清网络摄像机"),
    BayonetCamera7(7,"停车场网络摄像机");


    private Integer code;
    private String chinese;

    BayonetCameraEnum(Integer code, String chinese) {
        this.code = code;
        this.chinese = chinese;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getChinese() {
        return chinese;
    }

    public void setChinese(String chinese) {
        this.chinese = chinese;
    }

    /**
     * 判断值是否存在
     * @param str
     * @return
     */
    public static boolean isHas(String str){
        boolean bol =false;
        for (BayonetCameraEnum val : BayonetCameraEnum.values()){
            if(val.getChinese().equals(str.trim())){
                bol =true;
                break;
            }
        }
        return bol;
    }

    /**
     * 根据值获取ID
     * @param value
     * @return
     */
    public static Integer getId(String value){
        Integer id = null;
        for (BayonetCameraEnum val : BayonetCameraEnum.values()){
            if(val.chinese.equals(value.trim())){
                id = val.code;
                break;
            }
        }
        return id;
    }

    /**
     * 根据ID获取值
     * @param id
     * @return
     */
    public static String getValue(Integer id){
        String iRet = "";
        for (BayonetCameraEnum val : BayonetCameraEnum.values()){
            if(val.code==id){
                iRet = val.chinese;
                break;
            }
        }
        return iRet;
    }
}
